package stark.app.function.riddle;

import android.os.Bundle;

import com.stark.riddle.lib.RiddleModule;
import com.stark.riddle.lib.model.RiddleConst;
import com.stark.riddle.lib.ui.RiddleKindFragment;

import stark.app.R;
import stark.app.base.BaseWithFragmentActivity;
import stark.app.databinding.ActivityRiddleDemoBinding;
import stark.common.basic.base.BaseNoModelActivity;
import stark.common.basic.constant.Extra;

/**
 * Author：daizhongbin on 2021/11/13
 * Email：1027154338@qq.com
 * Desc:
 */
public class RiddleDemoActivity extends BaseNoModelActivity<ActivityRiddleDemoBinding> {

    @Override
    protected int onCreate() {
        return R.layout.activity_riddle_demo;
    }

    @Override
    protected void initView() {
        mDataBinding.btnRiddle.setOnClickListener(v -> {
            BaseWithFragmentActivity.start(this, "谜语", RiddleKindFragment.class,
                    getFragmentArg(RiddleConst.FuncType.RIDDLE));
        });
        mDataBinding.btnSaying.setOnClickListener(v -> {
            BaseWithFragmentActivity.start(this, "歇后语", RiddleKindFragment.class,
                    getFragmentArg(RiddleConst.FuncType.SAYING));
        });
        mDataBinding.btnTwister.setOnClickListener(v -> {
            BaseWithFragmentActivity.start(this, "脑筋急转弯", RiddleKindFragment.class,
                    getFragmentArg(RiddleConst.FuncType.TWISTER));
        });
    }

    @Override
    protected void initData() {
        RiddleModule.init(null);
    }

    private Bundle getFragmentArg(RiddleConst.FuncType funcType) {
        Bundle bundle = new Bundle();
        bundle.putSerializable(Extra.TYPE, funcType);
        return bundle;
    }
}
